package amushen.tree;

import java.util.List;
import java.util.Map;

/**
 * define the tree interfaces
 * any other Jsp will invoke a BO implemented this interface accrows a Action
 */
public interface ITree {

	/**
	 * get the root html string
	 * @return
	 */
	public TreeNode[] getRoot();
	
	public String getRootHtml();
	
	/**
	 * get sub items of this
	 * @param id  this's id
	 * @return
	 */
	public TreeNode[] getSub(String id);
	
	public String getSubHtml(String id);
	
	
	/**
	 * get a attribute value by name
	 * @param id
	 * @param attributeName
	 * @return
	 */
	public Object getAttribute(String id,String attributeName);

	/**
	 * get a map contains full of attributes
	 * @param id
	 * @return
	 */
	public Map getAttributes(String id);
	
	
	/**
	 * insert a child node
	 * @param id
	 * @param child
	 * @return
	 */
	public int insertChild(String id,Object child);
	
	/**
	 * delete a tree node
	 * @param id
	 * @return
	 */
	public int deleteNode(String id);
	
	/**
	 * update a tree node 
	 * @param id
	 * @param node
	 * @return
	 */
	public int updateNode(String id,Object node);
	
	/**
	 * move a node to a new parent
	 * @param id
	 * @param newParentId
	 * @return
	 */
	public int moveTo(String id,String newParentId);
}
